{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.8.3+55.g0433f90.dirty\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import folium\n",
    "\n",
    "print(folium.__version__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgCiAgICAgICAgPHNjcmlwdD4KICAgICAgICAgICAgTF9OT19UT1VDSCA9IGZhbHNlOwogICAgICAgICAgICBMX0RJU0FCTEVfM0QgPSBmYWxzZTsKICAgICAgICA8L3NjcmlwdD4KICAgIAogICAgPHNjcmlwdCBzcmM9Imh0dHBzOi8vY2RuLmpzZGVsaXZyLm5ldC9ucG0vbGVhZmxldEAxLjUuMC9kaXN0L2xlYWZsZXQuanMiPjwvc2NyaXB0PgogICAgPHNjcmlwdCBzcmM9Imh0dHBzOi8vY29kZS5qcXVlcnkuY29tL2pxdWVyeS0xLjEyLjQubWluLmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9qcy9ib290c3RyYXAubWluLmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5qcyI+PC9zY3JpcHQ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246YWJzb2x1dGU7dG9wOjA7Ym90dG9tOjA7cmlnaHQ6MDtsZWZ0OjA7fTwvc3R5bGU+CiAgICAKICAgICAgICAgICAgPG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCwKICAgICAgICAgICAgICAgIGluaXRpYWwtc2NhbGU9MS4wLCBtYXhpbXVtLXNjYWxlPTEuMCwgdXNlci1zY2FsYWJsZT1ubyIgLz4KICAgICAgICAgICAgPHN0eWxlPgogICAgICAgICAgICAgICAgI21hcF80MDliOTE5YjdiMGI0YjdmYjA3M2Q4MGY2MWM2OGY3MiB7CiAgICAgICAgICAgICAgICAgICAgcG9zaXRpb246IHJlbGF0aXZlOwogICAgICAgICAgICAgICAgICAgIHdpZHRoOiAxMDAuMCU7CiAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiAxMDAuMCU7CiAgICAgICAgICAgICAgICAgICAgbGVmdDogMC4wJTsKICAgICAgICAgICAgICAgICAgICB0b3A6IDAuMCU7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIDwvc3R5bGU+CiAgICAgICAgCjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICAgICAgICAgIDxkaXYgY2xhc3M9ImZvbGl1bS1tYXAiIGlkPSJtYXBfNDA5YjkxOWI3YjBiNGI3ZmIwNzNkODBmNjFjNjhmNzIiID48L2Rpdj4KICAgICAgICAKPC9ib2R5Pgo8c2NyaXB0PiAgICAKICAgIAogICAgICAgICAgICB2YXIgbWFwXzQwOWI5MTliN2IwYjRiN2ZiMDczZDgwZjYxYzY4ZjcyID0gTC5tYXAoCiAgICAgICAgICAgICAgICAibWFwXzQwOWI5MTliN2IwYjRiN2ZiMDczZDgwZjYxYzY4ZjcyIiwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBjZW50ZXI6IFs0MS4wLCAtNzAuMF0sCiAgICAgICAgICAgICAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NywKICAgICAgICAgICAgICAgICAgICB6b29tOiA1LAogICAgICAgICAgICAgICAgICAgIHpvb21Db250cm9sOiB0cnVlLAogICAgICAgICAgICAgICAgICAgIHByZWZlckNhbnZhczogZmFsc2UsCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICk7CgogICAgICAgICAgICAKCiAgICAgICAgCiAgICAKICAgICAgICAgICAgdmFyIHRpbGVfbGF5ZXJfMTUwOTU3OTAwMWJmNDFjN2IxMDgwODMxZjdjZWY2ZjUgPSBMLnRpbGVMYXllcigKICAgICAgICAgICAgICAgICJodHRwOi8ve3N9Lmdvb2dsZS5jb20vdnQvbHlycz1zXHUwMDI2eD17eH1cdTAwMjZ5PXt5fVx1MDAyNno9e3p9IiwKICAgICAgICAgICAgICAgIHsiYXR0cmlidXRpb24iOiAiZ29vZ2xlIiwgImRldGVjdFJldGluYSI6IGZhbHNlLCAibWF4TmF0aXZlWm9vbSI6IDIwLCAibWF4Wm9vbSI6IDIwLCAibWluWm9vbSI6IDAsICJub1dyYXAiOiBmYWxzZSwgIm9wYWNpdHkiOiAxLCAic3ViZG9tYWlucyI6IFsibXQwIiwgIm10MSIsICJtdDIiLCAibXQzIl0sICJ0bXMiOiBmYWxzZX0KICAgICAgICAgICAgKS5hZGRUbyhtYXBfNDA5YjkxOWI3YjBiNGI3ZmIwNzNkODBmNjFjNjhmNzIpOwogICAgICAgIAogICAgCiAgICAgICAgICAgIHZhciB0aWxlX2xheWVyXzZmMjAwZmQxMTMwZDRiNGVhZTY2MjQxZjJlODA3M2RmID0gTC50aWxlTGF5ZXIoCiAgICAgICAgICAgICAgICAiaHR0cDovL3tzfS5nb29nbGUuY29tL3Z0L2x5cnM9bVx1MDAyNng9e3h9XHUwMDI2eT17eX1cdTAwMjZ6PXt6fSIsCiAgICAgICAgICAgICAgICB7ImF0dHJpYnV0aW9uIjogImdvb2dsZSIsICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwgIm1heE5hdGl2ZVpvb20iOiAyM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cl82ZjIwMGZkMTEzMGQ0YjRlYWU2NjI0MWYyZTgwNzNkZiwKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBvdmVybGF5cyA6ICB7CiAgICAgICAgICAgICAgICAgICAgInRlc3QiIDogbWFjcm9fZWxlbWVudF9kNDAzNGVjYzNkMDA0OWE0ODFhM2E0MTU0NzcwOGNhNSwKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEwuY29udHJvbC5sYXllcnMoCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sXzE0YzljZWYxYzZmODQ5MTJhMDgwN2Y0OGZjODUxYzkzLmJhc2VfbGF5ZXJzLAogICAgICAgICAgICAgICAgbGF5ZXJfY29udHJvbF8xNGM5Y2VmMWM2Zjg0OTEyYTA4MDdmNDhmYzg1MWM5My5vdmVybGF5cywKICAgICAgICAgICAgICAgIHsiYXV0b1pJbmRleCI6IHRydWUsICJjb2xsYXBzZWQiOiB0cnVlLCAicG9zaXRpb24iOiAidG9wcmlnaHQifQogICAgICAgICAgICApLmFkZFRvKG1hcF80MDliOTE5YjdiMGI0YjdmYjA3M2Q4MGY2MWM2OGY3Mik7CiAgICAgICAgICAgIHRpbGVfbGF5ZXJfNmYyMDBmZDExMzBkNGI0ZWFlNjYyNDFmMmU4MDczZGYucmVtb3ZlKCk7CiAgICAgICAgICAgIHRpbGVfbGF5ZXJfMTUwOTU3OTAwMWJmNDFjN2IxMDgwODMxZjdjZWY2ZjUucmVtb3ZlKCk7CiAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
      ],
      "text/plain": [
       "<folium.folium.Map at 0x7fba259a03c8>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "m = folium.Map(location=[41, -70], zoom_start=5, tiles=None)\n",
    "\n",
    "\n",
    "folium.raster_layers.TileLayer(\n",
    "    tiles='http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',\n",
    "    attr='google',\n",
    "    name='google maps',\n",
    "    max_zoom=20,\n",
    "    subdomains=['mt0', 'mt1', 'mt2', 'mt3'],\n",
    "    overlay=False,\n",
    "    control=True,\n",
    ").add_to(m)\n",
    "\n",
    "folium.raster_layers.TileLayer(\n",
    "    tiles='http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',\n",
    "    attr='google',\n",
    "    name='google street view',\n",
    "    max_zoom=20,\n",
    "    subdomains=['mt0', 'mt1', 'mt2', 'mt3'],\n",
    "    overlay=False,\n",
    "    control=True,\n",
    ").add_to(m)\n",
    "\n",
    "\n",
    "folium.raster_layers.WmsTileLayer(\n",
    "    url='http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi',\n",
    "    name='test',\n",
    "    fmt='image/png',\n",
    "    layers='nexrad-n0r-900913',\n",
    "    attr=u'Weather data © 2012 IEM Nexrad',\n",
    "    transparent=True,\n",
    "    overlay=True,\n",
    "    control=True,\n",
    ").add_to(m)\n",
    "\n",
    "folium.LayerControl().add_to(m)\n",
    "\n",
    "m.save(os.path.join('results', 'WMS_and_WMTS.html'))\n",
    "\n",
    "m"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
